﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ajax_tinnhan_page.aspx.cs" Inherits="web_pages_ajax_tinnhan_page" %>
<%@ OutputCache Duration="1" VaryByParam="None" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <script type="text/javascript">
	    function ViewContent(id)
	    {
		    if(document.getElementById('sms_content_'+id).style.display == 'none') {
			    document.getElementById('sms_content_'+id).style.display = 'block';
			    
			    loadajaxtinnhan(<%=type%>,<%=act%>,'upd',id);
			    }
		    else
			    document.getElementById('sms_content_'+id).style.display = 'none';
	    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <% 
        if (mess.Length > 1)
        {
    %>`
        <div style="padding: 0pt 0.7em;" class="ui-state-error ui-corner-all"> 
            <p><span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-alert"></span> 
            <strong>Chú Ý:</strong><br /> <%=mess%></p>
        </div>
    <%
        }else if(messok.Length>1){
    %>
        <div style="padding: 0pt 0.7em;" class="ui-state-highlight ui-corner-all"> 
            <p><span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span> 
                <%=messok%></p>
        </div>
    <%}else{ %>
        <div>
            <table class="atable" style="width:99.5%; text-align: left;" >
                <thead>
                    <tr>
                        <th style="width: 20%; height: 20px;">
                            Tiêu đề</th>
                        <th style="width: 20%; height: 20px;">
                            Người gửi</th>
                        <th style="width: 20%; height: 20px;">
                            Người nhận</th>
                        <th style="width: 20%; height: 20px;">
                            Ngày gửi</th>
                        <th style="width: 20%; height: 20px;">
                            Hành động</th>
                    </tr>
                </thead>
                <asp:Repeater ID="rpt_list_obj" runat="server" OnItemDataBound="rpt_list_obj_ItemDataBound">
                    <ItemTemplate>
                    <tr>
                        <td  style="height: 1px; width: 367px; border-bottom: #ccc 1px dotted;" >
                            <span class="ui-icon ui-icon-arrowreturnthick-1-e" style="float:left"></span>
                            <a href="javascript:void(0);" onClick="ViewContent(<%# DataBinder.Eval(Container.DataItem, "id")%>)">
                            <span style="color:Olive;"><%# DataBinder.Eval(Container.DataItem, "tieu_de")%></span></a>
                            
                        </td>
                        <td style="height: 1px; width: 151px; border-bottom: #ccc 1px dotted;text-align:center">
                            <%# DataBinder.Eval(Container.DataItem, "ten_nguoi_gui")%>
                        </td>
                        <td style="height: 1px; width: 151px; border-bottom: #ccc 1px dotted;"> 
                            <%# DataBinder.Eval(Container.DataItem, "ten_nguoi_nhan")%>
                        </td>
                        <td style="height: 1px; width: 134px; border-bottom: #ccc 1px dotted;text-align:center">
                            <%# DataBinder.Eval(Container.DataItem, "ngay_gui")%>
                        </td>
                        <td style="height: 1px; width: 134px; border-bottom: #ccc 1px dotted;text-align:left">
                            <a href="javascript:loadajaxtinnhan(<%=type%>,<%=act%>,'del',<%#DataBinder.Eval(Container.DataItem,"id")%>);"  onclick="return confirm('Bạn có chắc chắn muốn xóa tin nhắn này không?');">[Xóa]</a>
                            <%if (type == "0")
                              { %>
                                <a href="javascript:void(0);" onclick="javascript:window.open('nhantin.aspx?idgui=<%=Session["NTV_id"]%>&idnhan=<%# DataBinder.Eval(Container.DataItem,"idgui")%>&type=0','','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=480,left = 320,top = 160')">[Trả lời]</a>
                            <%} %>
                            <%if (act == "0" && type!="2")
                              { %>
                                <a href="javascript:void(0);" onclick="javascript:loadajaxtinnhan(<%=type%>,<%=act%>,'upd',<%#DataBinder.Eval(Container.DataItem,"id")%>);">[Đánh dấu đọc]</a>
                            <%} %>
                        </td>
                    </tr>
                    <tr>
				        <td colspan="5" align="left"  style="border-bottom:none;border-top:none;">
					        <div style="color:#0033FF;display:none;padding-left:15px;border-bottom:1px solid #FF6600;padding-bottom:10px;" 
					        id="sms_content_<%# DataBinder.Eval(Container.DataItem, "id")%>"><%# DataBinder.Eval(Container.DataItem, "noi_dung")%></div>
				        </td>
			        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </table> 
        </div>
    <%} %>
    </form>
</body>
</html>
